Skip to content

HDDS-13184. Persist Block Size in Delete Transaction for SCM#9272

Merged
ChenSammi merged 11 commits intoapache:masterfrom
priyeshkaratha:HDDS-13184_PersistBlockSize
Nov 19, 2025
Merged

HDDS-13184. Persist Block Size in Delete Transaction for SCM#9272
ChenSammi merged 11 commits intoapache:masterfrom
priyeshkaratha:HDDS-13184_PersistBlockSize

Conversation

@priyeshkaratha
Copy link
Contributor

@priyeshkaratha priyeshkaratha commented Nov 10, 2025

What changes were proposed in this pull request?

  • Add a DeletedBlocksTransactionSummary to count the block deletion transaction count, all involved block count, all size and replicated size of all involved block.
  • When block deletion transaction is persisted into SCM DB, transaction info is updated to increase in DeletedBlocksTransactionSummary. When block deletion transaction is removed from SCM DB, transaction info is updated to decrease in DeletedBlocksTransactionSummary. Any retry command of transaction doesn't affect the DeletedBlocksTransactionSummary.
  • Upgrading, for an existing Ozone cluster, all existing block deletion transaction prior to STORAGE_SPACE_DISTRIBUTION finalized, will be ignored to update DeletedBlocksTransactionSummary when it's removed from SCM DB. DeletedBlocksTransactionSummary only counts the transaction after STORAGE_SPACE_DISTRIBUTION is finalized.
  • Add a new CLI to query DeletedBlocksTransactionSummary.
  • Expose the DeletedBlocksTransactionSummary through metrics.
  • DB size increase consideration, refer to TestDeletedBlockLog#testTransactionSerializedSize comments
  • Performance consideration, refer to TestDeletedBlockLog#testAddRemoveTransactionPerformance comments

What is the link to the Apache JIRA

HDDS-13184

How was this patch tested?

New unit tests added. And its tested in feature branch part of #8845

@priyeshkaratha priyeshkaratha force-pushed the HDDS-13184_PersistBlockSize branch from 5eef1e6 to 53f34b2 Compare November 11, 2025 04:11
@priyeshkaratha priyeshkaratha marked this pull request as ready for review November 13, 2025 05:15
Copy link
Contributor

@sumitagrawl sumitagrawl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@priyeshkaratha given few comments

@priyeshkaratha priyeshkaratha force-pushed the HDDS-13184_PersistBlockSize branch from 2e190fd to f6b1f4a Compare November 16, 2025 14:55
@priyeshkaratha priyeshkaratha force-pushed the HDDS-13184_PersistBlockSize branch 2 times, most recently from 49b6dc9 to 3173e98 Compare November 17, 2025 09:21
@priyeshkaratha priyeshkaratha force-pushed the HDDS-13184_PersistBlockSize branch from 3173e98 to 26aa826 Compare November 17, 2025 13:40
@priyeshkaratha priyeshkaratha force-pushed the HDDS-13184_PersistBlockSize branch from 26aa826 to 7300f52 Compare November 17, 2025 13:59
Copy link
Contributor

@ChenSammi ChenSammi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @priyeshkaratha for the contribution , and @sumitagrawl for the review.

@ChenSammi ChenSammi merged commit b6c742e into apache:master Nov 19, 2025
83 of 84 checks passed
Copy link
Contributor

@sumitagrawl sumitagrawl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@priyeshkaratha Some additional minor review comments are there after previous fix, please handle with new JIRA

private final AtomicLong txFlushPending = new AtomicLong(0);
private long lastSnapshotTimeMs = 0;
private final ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock();
private boolean autoFlushEnabled = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flag is of no meaning now, can be removed

}

private void initDataDistributionData() throws IOException {
if (VersionedDatanodeFeatures.isFinalized(HDDSLayoutFeature.STORAGE_SPACE_DISTRIBUTION)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

STORAGE_SPACE_DISTRIBUTION check may not be required, it will not be available before finalize and on first startup for new version,


@Nullable
public DeletedBlocksTransactionSummary getTransactionSummary() {
if (!VersionedDatanodeFeatures.isFinalized(HDDSLayoutFeature.STORAGE_SPACE_DISTRIBUTION)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

STORAGE_SPACE_DISTRIBUTION here also not required, by default will be 0 if not finalized, this is redundant check.

}

@Override
public ArrayList<DeletedBlocksTransaction> getTransactionsFromDB(ArrayList<Long> txIDs) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No call of this api is found, unused method to be removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants